<%@ page contentType="text/html;charset=UTF-8" session="false" %>
<%@ include file="/WEB-INF/common/includes.jsp" %>
<script type="text/javascript">
	$(function() {
		onFormValidate();
	});
	
	function onFormValidate(){
		$('#articleForm').validate({
			rules : {
				title : {
					required : true
				},
				text : {
					minlength : 3,
					required : true
				}
			},
			highlight : function(label) {
				$(label).closest('.control-group').addClass('error');
			},
			success : function(label) {
				$(label).closest('.control-group').addClass('success');
			}
		});
	}
</script>

<div class="control-group">
	<form:label path="title">标题</form:label>
	<form:input path="title" cssClass="input-large" placeholder="标题" />
	<form:errors path="title" cssClass="text-error" />
</div>
<div class="control-group">
	<form:label path="textN">正文</form:label>
	<form:textarea path="textN" placeholder="正文" cssStyle="width:520px; height:400px;" />
	<form:errors path="textN" cssClass="text-error" />
</div>
<div class="control-group">
	<form:label path="textS">简介</form:label>
	<form:textarea path="textS" placeholder="简介" cssStyle="width:520px; height:150px;" />
	<form:errors path="textS" cssClass="text-error" />
</div>
<div class="control-group">
	<form:label path="tags">标签</form:label>
	<form:input path="tags" cssClass="input-large" placeholder="标签" />
	<form:errors path="tags" cssClass="text-error" />
</div>

<script type="text/javascript" src="${ctx}/res/kindeditor/kindeditor-min.js"></script>

<script>

var editorTextS;
KindEditor.ready(function(K) {
	editorTextS = K.create('textarea[name="textN"]', {
		resizeType : 1,
		allowImageUpload : true,
		allowPreviewEmoticons : false,
		allowFlashUpload : false,
		uploadJson : '${ctx}/article/upload',
		items : [
			'fontname', 'fontsize', '|', 'forecolor', 'hilitecolor', 'bold', 'italic', 'underline',
			'removeformat', '|', 'justifyleft', 'justifycenter', 'justifyright', 'insertorderedlist',
			'insertunorderedlist', '|', 'emoticons', 'image', 'link']
	});
});

</script>